package com.lagou.homework;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class WorkerTest {
    public static void main(String[] args) {
        List lis = new ArrayList();
        lis.add(new Worker("凤姐",18,20000));
        lis.add(new Worker("欧阳锋",60,8000));
        lis.add(new Worker("刘德华",40,30000));
        lis.add(1,new Worker("张柏芝",35,3300));
        System.out.println(lis);
        lis.remove(3);
        System.out.println(lis);
        System.out.println("------------");
        for (Object obj : lis){
            System.out.println((Worker)obj);
        }
        System.out.println("----------------------------------");
        Iterator it = lis.iterator();
        while (it.hasNext()){
            System.out.println(it.next());
        }
        System.out.println("-------------------------------------");
        for (int i =0;i<lis.size();i++){
            Worker w1 = (Worker)lis.get(i);
            w1.work();
        }

        Worker p1 = new Worker("1",1,1);
        Worker p2 = new Worker("1",1,2);
        Worker p3 = new Worker("1",1,1);
        System.out.println(p1.equals(p2));
        System.out.println(p1.equals(p3));
    }
}
